home *** CD-ROM | disk | FTP | other *** search
- package symantec.itools.util;
-
- import java.awt.Component;
- import java.awt.Event;
-
- public class Timer implements Runnable {
- Component target;
- int eventType;
- boolean repeat;
- boolean repeating;
- boolean execute;
- Thread thread;
- int delay;
-
- public Timer(Component var1) {
- this(var1, 1000);
- }
-
- public Timer(Component var1, int var2) {
- this(var1, var2, false);
- }
-
- public Timer(Component var1, int var2, boolean var3) {
- this(var1, var2, var3, 1001);
- }
-
- public Timer(Component var1, int var2, boolean var3, int var4) {
- this.target = var1;
- this.delay = var2;
- this.repeat = var3;
- this.execute = false;
- this.thread = new Thread(this);
- this.eventType = var4;
- this.thread.start();
- }
-
- public void setEventType(int var1) {
- this.eventType = var1;
- }
-
- public int getEventType() {
- return this.eventType;
- }
-
- public void setTarget(Component var1) {
- this.target = var1;
- }
-
- public Component getTarget() {
- return this.target;
- }
-
- public void setDelay(int var1) {
- this.delay = var1;
- }
-
- public int getDelay() {
- return this.delay;
- }
-
- public void start() {
- this.execute = true;
- this.thread.resume();
- }
-
- public void setRepeat(boolean var1) {
- this.repeat = var1;
- }
-
- public boolean getRepeat() {
- return this.repeat;
- }
-
- public void start(int var1) {
- this.delay = var1;
- this.start();
- }
-
- public void start(boolean var1) {
- this.repeat = var1;
- this.start();
- }
-
- public void start(int var1, boolean var2) {
- this.delay = var1;
- this.repeat = var2;
- this.start();
- }
-
- public void stop() {
- this.execute = false;
- this.repeating = false;
- }
-
- public void run() {
- if (!this.execute) {
- this.thread.suspend();
- }
-
- try {
- while(true) {
- this.repeating = this.repeat;
-
- do {
- Thread.sleep((long)this.delay);
- if (this.execute) {
- this.target.handleEvent(new Event(this, this.eventType, (Object)null));
- }
- } while(this.repeating);
-
- this.thread.suspend();
- }
- } catch (InterruptedException var1) {
- }
- }
- }
-